﻿namespace CRM.Business.Services
{
    using System.Collections.Generic;
    using CRM.DataAccess.DAOs;
    using CRM.DataAccess.Entities;
    using System;

    public static class ProductService
    {
        /// Gets or sets the role DAO.
        private static ProductDAO ProductDAO = new ProductDAO();

        //Get Manufacturer
        public static List<PRODUCT_MANUFACTURER> GetProductManufacturer()
        {
            return ProductDAO.GetProductManufacturer();
        }
        //Get Category
        public static List<PRODUCT_CATEGORY> GetProductCategory()
        {
            return ProductDAO.GetProductCategory();
        }
        //Get Usage Unit
        public static List<PRODUCT_USAGE_UNIT> GetProductUsageUnit()
        {
            return ProductDAO.GetProductUsageUnit();
        }
        //Get product by ProductID
        public static PRODUCT GetProductByID(long id)
        {
            return ProductDAO.GetProductByID(id);
        }
        //Get all product
        public static List<PRODUCT> GetAllProduct(long? assignedToID)
        {
            return ProductDAO.GetAllProduct(assignedToID);
        }
       //Get product detail by ID
        public static PRODUCT_DETAIL GetProductDetailByID(long id)
        {
            return ProductDAO.GetProductDetailByID(id);
        }
        //Get top 1 product
        public static PRODUCT GetTop1Product(long? assignedToID)
        {
            return ProductDAO.GetTop1Product(assignedToID);
        }
        //update product
        public static int UpdateProduct(PRODUCT pro)
        {
            return ProductDAO.UpdateProduct(pro);
        }
        //Get product by condition
        public static List<PRODUCT_DETAIL> GetProductByCondition(DateTime? dateFrom, DateTime? dateTo, string productName, string partNumber, double? unitPrice, long? assignedtoID)
        {
            return ProductDAO.GetProductByCondition(dateFrom, dateTo,productName, partNumber, unitPrice, assignedtoID);
        }
        //Delete Product
        public static int DeleteProduct(long proID)
        {
            return ProductDAO.DeleteProduct(proID);
        }
        //Add new product
        public static int AddNewProduct(PRODUCT p)
        {
            return ProductDAO.AddNewProduct(p);
        }

        public static int AddNewSupplier(PRODUCT_MANUFACTURER proM)
        {
            return ProductDAO.AddNewSupplier(proM);
        }
        

    }
}
